package com.pf.责任链模式.spring.demo1;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class Context {

    @Autowired
    private List<Leader> leaders;

    public void handleRequest(LeaveRequest leaveRequest) {
        for (Leader leader : leaders) {
            if (!leader.handleRequest(leaveRequest)) {
                return;
            }
        }
    }
}
